
function Map(ctx) {
  this.w = 2400; // 地图宽
  this.h = 24; // 地图高
  this.y = sence.height - 30;
  this.x = 0;
  this.ctx = ctx; // 2d 绘图的上下文 
  this.speed = 5;
}

Map.prototype = {
  draw () {
    this.ctx.drawImage(imgSprite, mapSprite.x, mapSprite.y, this.w, this.h, this.x, this.y, this.w, this.h);
    this.ctx.drawImage(imgSprite, mapSprite.x, mapSprite.y, this.w, this.h, this.x + 2400, this.y, this.w, this.h);
    this.move();
  },
  move() {
    this.x = this.x -this.speed;
    if (this.x < -2400) {
      this.x = 0;
    }
  }
}




